package com.victor.dao;

import java.util.HashMap;
import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.victor.entity.Jingdianintroduce;
import com.victor.entity.Jingdiantupian;
import com.victor.entity.Jingquclass;
import com.victor.entity.Jingqucomment;
import com.victor.entity.Jingqucommentphoto;
import com.victor.entity.Jingqujingdian;
import com.victor.entity.Jingqulist;
import com.victor.entity.Jingqutupian;
import com.victor.entity.JqCollection;
import com.victor.entity.JqReply;
import com.victor.entity.JqcommentPraise;
import com.victor.entity.JqcommentsReply;

@Mapper
public interface JingquDao {

	/**
	 * 获取所有景区类别
	 */
	@Select({ "select * from jingquclass order by id desc" })
	List<Jingquclass> getClassList();

	/**
	 * 添加景区类型
	 */
	@Insert({ "insert into jingquclass (jqclassname,jqphoto) values (#{jqclassname},#{jqphoto})" })
	int addClass(Jingquclass jingquclass);

	/**
	 * 修改类别信息
	 */
	int updateClass(Jingquclass jingquclass);

	/**
	 * 批量删除类别
	 */
	int deleteClass(@Param("ids") int[] ids);

	/**
	 * 获取景区列表
	 * 
	 * @param jqclass
	 * @param starttime
	 * @param endtime
	 * @param searchname
	 * @return
	 */
	List<Jingqulist> getJQlist(@Param("jqclassid") String jqclassid, @Param("starttime") String starttime,
			@Param("endtime") String endtime, @Param("searchname") String searchname);

	/**
	 * 新建景区--添加景区信息
	 * 
	 * @param jingqulist
	 * @return
	 */
	int buildJQ(Jingqulist jingqulist);

	/**
	 * 添加景区图片信息
	 * 
	 * @param jingqutupian
	 * @return
	 */
	@Insert({ "insert into jingqutupian (jqphoto,jqid) values (#{jqphoto},#{jqid})" })
	int addJingqutupian(Jingqutupian jingqutupian);

	/**
	 * 批量删除
	 * 
	 * @param jqids
	 * @return
	 */
	int batchDeleteJQ(@Param("jqids") int[] jqids);

	/**
	 * 景区详情
	 * 
	 * @param jqid
	 * @return
	 */
	Jingqulist getJQxqByid(@Param("jqid") String jqid);

	/**
	 * 修改景区信息
	 * 
	 * @param jingqulist
	 * @return
	 */
	int updateJQ(Jingqulist jingqulist);

	/**
	 * 添加景点
	 * 
	 * @param jingqujingdian
	 * @return
	 */
	int addJingdian(Jingqujingdian jingqujingdian);

	/**
	 * 添加景点图片
	 * 
	 * @param jingdiantupian
	 * @return
	 */
	@Insert({ "insert into jingdiantupian (jdphoto,jdid) values (#{jdphoto},#{jdid}) " })
	int addJingdiantupian(Jingdiantupian jingdiantupian);

	/**
	 * 删除景点
	 * 
	 * @param jdid
	 * @return
	 */
	int deleteJingdianByid(@Param("jdid") String jdid);

	/**
	 * 添加景点简介
	 * 
	 * @param jingdianintroduce
	 * @return
	 */
	@Insert({ "insert into jingdianintroduce (jdintroduce,jdid) values (#{jdintroduce},#{jdid})" })
	int addJdintroduce(Jingdianintroduce jingdianintroduce);

	/**
	 * 删除评论
	 * 
	 * @param cid
	 * @return
	 */
	@Delete({ "delete from jingqucomment where id=#{cid}" })
	int deleteCommentByid(@Param("cid") String cid);

	/**
	 * 修改景点
	 * 
	 * @param jingqujingdian
	 * @return
	 */
	boolean updateJD(Jingqujingdian jingqujingdian);

	/**
	 * 删除景点原图片
	 * 
	 * @param jdid
	 * @return
	 */
	@Delete({ "delete from jingdiantupian where jdid=#{jdid}" })
	int deleteJingdianTup(@Param("jdid") Integer jdid);

	/**
	 * 删除景点原简介
	 * 
	 * @param jdid
	 * @return
	 */
	@Delete({ "delete from jingdianintroduce where jdid=#{jdid}" })
	int deleteJingdianJJ(@Param("jdid") Integer jdid);
	/**
	 * 景区图片根据id查询
	 * @param id
	 * @return
	 */
	@Select({"select * from jingqutupian where id=#{id}"})
	List<Jingqutupian> selJingqutupianById(Integer id);
	/**
	 * 删除景区
	 * @param id
	 * @return
	 */
    int deleteByPrimaryKey(int[] id);
    /**
     * 景区详情（没登陆）
     * @param id
     * @return
     */
    Jingqulist selectByPrimaryKey(String id);
    /**
     * 查询全部
     * @return
     */
    @Select({"select * from jingqulist"})
	List<Jingqulist> selAll();
    /**
     * 根据省，市，搜索条件查询
     * @param map
     * @return
     */
	List<Jingqulist> selByCondition(HashMap<Object, Object> map);
	/**
	 * 查询评论（没登陆）
	 * @param jqid
	 * @param flag
	 * @return
	 */
	List<Jingqucomment> selcomments(@Param("jqid")String jqid,@Param("flag") String flag);
	/**
	 * 查询评论的回复数
	 * @param jqid
	 * @return
	 */
	@Select({"select * from jqcommentsreply where cid=#{id} "})
	List<JqcommentsReply> selCommentsReply(Integer id);
	/**
	 * 评论回复的回复
	 * @param commentsreplysize
	 * @return
	 */
	List<JqReply> selReply(String[] commentsreplysize);
	/**
	 * 景区详情（登陆）
	 * @param jqid
	 * @param uid
	 * @return
	 */
	Jingqulist selectByPrimaryKeyAndUid(@Param("jqid")String jqid,@Param("uid") String uid);
	/**
	 * 查询评论（登陆）
	 * @param jqid
	 * @param flag
	 * @param uid
	 * @return
	 */
	List<Jingqucomment> selcommentsByUid(@Param("jqid")String jqid,@Param("flag") String flag,@Param("uid") String uid);
	/**
	 * 添加收藏
	 * @param collection
	 * @return
	 */
	boolean insertJqCollection(JqCollection collection);
	/**
	 * 查询评论点赞
	 * @param praise
	 * @return
	 */
	JqcommentPraise selJqCommentsPraise(JqcommentPraise praise);
	/**
	 * 添加景区评论点赞
	 * @param praise
	 * @return
	 */
	boolean insertJqCommentsPraise(JqcommentPraise praise);
	/**
	 * 景区评论点赞数
	 * @param jcid
	 * @return
	 */
	String selPraiseCount(String jcid);
	/**
	 * 删除评论点赞
	 * @param id
	 * @return
	 */
	boolean delCommentsPraise(Integer id);
	/**
	 * 添加评论
	 * @param cJingqucomment
	 * @return
	 */
	boolean insertComments(Jingqucomment cJingqucomment);
	/**
	 * 添加评论图片
	 * @param jingqucommentphoto
	 * @return
	 */
	boolean insertJqCommentsPhoto(Jingqucommentphoto jingqucommentphoto);
	/**
	 * 添加景区评论回复
	 * @param reply
	 * @return
	 */
	boolean insertJqCommentsReply(JqcommentsReply reply);
	/**
	 * 添加回复 回复
	 * @param reply
	 * @return
	 */
	boolean insertReply(JqReply reply);
	/**
	 * 查询景区收藏
	 * @param collection
	 * @return
	 */
	JqCollection selCollection(JqCollection collection);
	/**
	 * 删除收藏
	 * @param id
	 * @return
	 */
	boolean delCollection(Integer id);
	/**
	 * 多条件查询景区
	 * @param city
	 * @param jqclassid
	 * @param tjflag
	 * @param jqlevel
	 * @return
	 */
	List<Jingqulist> selByMuchCondition(@Param("city")String city,@Param("search")String search,@Param("jqclassid") String jqclassid,@Param("tjflag") String tjflag,@Param("jqlevel") String jqlevel,@Param("price")String price);
	

}
